package com.mmy.service.impl.hotel;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mmy.dao.hotel.THotelRoomRepository;
import com.mmy.domain.hotel.THotelRoom;
import com.mmy.service.hotel.THotelRoomService;

@Service
public class THotelRoomServiceImpl implements THotelRoomService {
	@Autowired
	private THotelRoomRepository tHotelRoomRepository;

	/**
	 * 获得最大房间编号
	 * 
	 * @return 返回值说明 最大ID
	 * @author 创建人 dingxd
	 * @date 创建日期 2020.11.17
	 */
	public int getMaxRoomID() {
		// 流水号
		Object objCode = tHotelRoomRepository.getMaxRoomID();
		int iID = 0;
		if (objCode != null) {
			iID = Integer.parseInt(objCode.toString());
		}
		return iID;
	}

	/* 创建房间 */
	public void save(int roomID) {
		// TODO Auto-generated method stub
		tHotelRoomRepository.save(roomID);
	}

	/* 创建修改房间 */
	public void save(THotelRoom tHotelRoom) {
		// TODO Auto-generated method stub
		tHotelRoomRepository.save(tHotelRoom);
	}

	/* 通过酒店编号查找 */
	public List<THotelRoom> findByHotelID(int iHotelID) {
		// TODO Auto-generated method stub
		return tHotelRoomRepository.findByHotelID(iHotelID);
	}

	/* 通过房间编号查找 */
	public THotelRoom findByiRoomID(int iRoomID) {
		// TODO Auto-generated method stub
		return tHotelRoomRepository.findByiRoomID(iRoomID);
	}

	/* 删除房间 */
	public void deleteChecked(List<Integer> iRoomIDs) {
		// TODO Auto-generated method stub
		tHotelRoomRepository.deleteChecked(iRoomIDs);
	}

	/* 查询所有房间 */
	public List<THotelRoom> findALL() {
		// TODO Auto-generated method stub
		return tHotelRoomRepository.findAll();
	}

	/*
	 * 查询该酒店的房间名称并且去重 public List<String> getNameByHotelID(int iHotelID) { // TODO
	 * Auto-generated method stub return
	 * tHotelRoomRepository.getNameByHotelID(iHotelID); }
	 */
}
